﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EAMF.Content.Projectiles
{
    public class PulsebombProj : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            ProjectileID.Sets.TrailingMode[Type] = 2;
            ProjectileID.Sets.TrailCacheLength[Type] = 1;

            base.SetStaticDefaults();
        }
        public override void SetDefaults()
        {
            Projectile.width = 77;
            Projectile.height = 2;
            Projectile.friendly = true;
            Projectile.timeLeft = 600;
            Projectile.penetrate = 1;
            Projectile.DamageType = DamageClass.Ranged;
            Projectile.alpha = 0;//透明度
            //Projectile.stepSpeed = 50;
        }
        public override void AI()
        {
            //在弹幕生成时就确定他的方向
            Projectile.rotation = Projectile.velocity.ToRotation();
            //// 让弹幕按照sin函数的周期性旋转，旋转弧度范围为[-0.5, 0.5]
            //float r = (float)Math.Sin(Main.time) * 0.5f;
            //// 哈哈，这是个内置的写法，能减少你的代码量（不用写Atan2和Cos，Sin了）
            //Projectile.velocity = Projectile.velocity.RotatedBy(r);
            base.AI();
        }
        public override bool PreDraw(ref Color lightColor)
        {
            EAMFUtils.DrawInPlayerCenter(Projectile, 2, lightColor);
            return false;
        }
    }
}
